package com.jinzhu.dao;

import com.jinzhu.pojo.Clazz;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface ClazzMapper {
    // 查询所有班级
    @Select("select * from clazz")
    List<Clazz> AllClass();
    // 根据ID删除班级
    @Delete("delete from clazz where id=#{id}")
    Integer delete(Integer id);
    // 添加班级
    @Insert("insert into clazz(name,room,begin_date,end_date,subject,create_time,update_time) " +
            "values(#{name},#{room},#{beginDate},#{endDate},#{subject},#{createTime},#{updateTime})")
    Integer add(Clazz clazz);
    // 根据ID查询班级
    @Select("select * from clazz where id = #{id}")
    Clazz get(Integer id);
    // 修改班级
    Integer update(Clazz clazz);
    // 根据内容查询班级
    List<Clazz> AllClass1(String name, LocalDate begin, LocalDate end);


}
